﻿/*
 *********************************************************************
 *    Management Extensions for Windows Windows Server AppFabric     *
 *********************************************************************
 *    Author    : Fatih Boy [fatih@enterprisecoding.com]             *
 *    Web site  : http://www.enterprisecoding.com                    *
 *********************************************************************
 *    License   : GNU Library General Public License (LGPL)          * 
 *********************************************************************
 */

using Microsoft.Web.Management.Client;
using Microsoft.Web.Management.Server;
using System;

namespace Com.Enterprisecoding.AppFabric.Extensions.Client.Pages.Cache.ConfigBackup {
    internal sealed class ConfigBackupServiceProxy : ModuleServiceProxy {
        public CacheClusterConfigExportInfo ExportCacheClusterConfig() {
            var invocationResult = base.Invoke("InvokeCacheConfigBackupServiceMethod", "ExportCacheClusterConfig", new object[0]) as PropertyBag;

            return ResultObjectWrapper.CreateInstace<CacheClusterConfigExportInfo>(invocationResult);
        }

        public CacheClusterConfigExport DownloadCacheClusterConfig(Guid configFileGuid, long startIndex) {
            var invocationResult = base.Invoke("InvokeCacheConfigBackupServiceMethod", "DownloadCacheClusterConfig", new object[] { configFileGuid, startIndex }) as PropertyBag;

            return ResultObjectWrapper.CreateInstace<CacheClusterConfigExport>(invocationResult);
        }

        public void ClearCacheClusterConfigExportFile(Guid configFileGuid) {
            base.Invoke("InvokeCacheConfigBackupServiceMethod", "ClearCacheClusterConfigExportFile", new object[] { configFileGuid });
        }

        public void UploadCacheClusterConfig(Guid configFileGuid, byte[] fileContent) {
            base.Invoke("InvokeCacheConfigBackupServiceMethod", "UploadCacheClusterConfig", new object[] { configFileGuid, fileContent });
        }

        public void ImportCacheClusterConfig(Guid configFileGuid) {
            base.Invoke("InvokeCacheConfigBackupServiceMethod", "ImportCacheClusterConfig", new object[] { configFileGuid });
        }
    }
}
